package org.example.service.impl;

import org.example.mapper.AccountMapper;
import org.example.service.AccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class AccountServiceImpl implements AccountService {

    @Autowired
    private AccountMapper accountMapper;

    @Override
    public void trans(Integer outId, Integer inId, Integer money) {
        //扣钱
        accountMapper.transOUt(outId, money);
        System.out.println(1/0);//模拟非正常情况，断电，系统奔溃
        //打钱
        accountMapper.transIn(inId, money);
    }
}
